--[[
--节点类型有指定范围的msg_id
--每个msg_id 对应消息名
--每个消息名 对应msg_id
]]

local base_id = 1000

local server_type_id = {
	gateserver = {1000, 2000},
	accountserver = {2000, 3000},
	hallserver = {3000, 4000},
	gameserver = {4000, 5000},
}

--消息id对应消息名
local protoIDs = {}

local min_id = server_type_id.accountserver[1]
protoIDs[min_id + 1] = "account.REQ_VERIFY"
protoIDs[min_id + 2] = "account.RSP_VERIFY"
protoIDs[min_id + 3] = "account.REQ_REGISTER_TOURIST"
protoIDs[min_id + 4] = "account.RSP_REGISTER_TOURIST"


local min_id = server_type_id.hallserver[1]
protoIDs[min_id + 1] = "hall.PING"
protoIDs[min_id + 2] = "hall.PONG"
protoIDs[min_id + 3] = "hall.REQ_LOGIN"
protoIDs[min_id + 4] = "hall.RSP_LOGIN"


local Proto = {}
for k, v in pairs(protoIDs) do
	Proto[k] = v --id对应名字
    Proto[v] = k --名字对应id
end

--通过msg_id取服务器类型
function Proto.getServerTypeById(msg_id) 
	for k, v in pairs(server_type_id) do 
		if msg_id >= v[1] and msg_id < v[2] then 
			return k
		end
	end
end

return Proto
